// const url = 'http://logisticsTest.shuimuchangxiang.com/admin/'
// const apiUrl = 'http://logisticsTest.shuimuchangxiang.com/admin/'
// const apiUrlOne = 'http://logisticsTest.shuimuchangxiang.com/admin/'


const url = 'http://logistics.shuimuchangxiang.com/admin/'
const apiUrl = 'http://logistics.shuimuchangxiang.com/admin/'
const apiUrlOne = 'http://logistics.shuimuchangxiang.com/admin/'

import Axios from "axios";
/**
 * 页面内容接口
 */
export default {
    /*** 添加收费项目列表 */
    addChargingItems: function({
        name
    }) {
        var param = {
            name: name
        };
        return Axios.post(apiUrl + 'chargingItems', param);
    },

    /*** 获取收费项目列表 */
    getChargingItems: function({
        name
    }) {
        if(name) {
            return Axios.get(apiUrl + 'chargingItems?name=' + name);
        } else {
            return Axios.get(apiUrl + 'chargingItems');
        }
    },

    /*** 添加收费项目列表 */
    editChargingItems: function({
        id,
        name
    }) {
        var param = {
            name: name
        };
        return Axios.put(apiUrl + 'chargingItems/' + id, param);
    },

    // 获取订单列表
    paymentlist: function(search) {
        if(search.name || search.id_card || search.notice_num || search.state || search.admin_users_id || search.star_time || search.end_time) {
            if(!search.name) delete search.name;
            if(!search.id_card) delete search.id_card;
            if(!search.notice_num) delete search.notice_num;
            if(!search.state) delete search.state;
            if(!search.admin_users_id) delete search.admin_users_id;
            if(!search.star_time) delete search.star_time;
            if(!search.end_time) delete search.end_time;
            return Axios.get(apiUrl + 'charge', {
                params: search
            });
        } else {
            delete search.name;
            delete search.id_card;
            delete search.notice_num;
            delete search.state;
            delete search.admin_users_id;
            delete search.star_time;
            delete search.end_time;
            return Axios.get(apiUrl + 'charge', {
                params: search
            });
        }
    },
     /*缴费管理详情列表*/
    payCodeList:function(search){
      return Axios.get( apiUrlOne+ 'students', {
                params: search
            });
      },
     outEdit:function(student,charge,pay_items) {
       console.log(student)
        var param = {
            "student": student==''?{}:student,
            "charge":charge==''?{}:charge,
            "pay_items":pay_items==''?{}:pay_items
        };
        console.log(param)
      return Axios.post(apiUrlOne + 'student', param);
     },
    // 订单详情
    paymentdetail: function({
        id
    }) {
        return Axios.get(apiUrl + 'charge/' + id);
    },

    // 修改支付订单
    editpayment: function({
        id
    }) {
        return Axios.put(apiUrl + 'charge/' + id);
    },

    // 修改学生套餐单价
    modifyStudentPrice: function(params) {
        return Axios.put(apiUrl + 'charge/change', params);
    },

    // 删除支付订单
    delepayment: function({
        id
    }) {
        return Axios.delete(apiUrl + 'charge/' + id);
    },

    //获取收费人员
    getchargeUsersList: function() {
        return Axios.get(apiUrl + 'chargeUsers');
    },

    // 套餐管理组件-套餐列表
    getAllPackageList: function() {
        return Axios.get(apiUrl + 'template/list');
    },

    /* 套餐内收费项目列表 */
    getProfessList: function() {
        return Axios.get(apiUrl + 'chargingItems');
    },

    /* 获取具体套餐信息 */
    getProfessName: function({
        id
    }) {
        return Axios.get(apiUrl + 'template/' + id);
    },

    /* 增加新套餐 */
    addProfessList: function({
        name,
        professionales_id,
        template_detail
    }) {
        var params = {
            name: name,
            professionales_id: professionales_id,
            template_detail: template_detail
        };
        // params = JSON.stringify(params);
        return Axios.post(apiUrl + 'template', params);
    },

    /* 修改套餐名 */
    editProfessName: function({
        id
    }) {
        return Axios.put(apiUrl + 'template/' + id);
    },

    /* 修改套餐详细数据 */
    editProfessData: function(params) {
        return Axios.put(apiUrl + 'templateDetailEdit', params);
    },

    /* 删除套餐详细数据 */
    deleteProfessData: function(params) {

        return Axios.post(apiUrl + 'templateDetailDel', params);
    },

    /* 获取系统所有专业 */
    getProfessAll: function() {
        return Axios.get(apiUrl + 'professionales');
    },

    /* 缴费统计 */
    getStatistical: function() {
        return Axios.get(apiUrl + 'charge/statistical/index');

    },

    /* 普通老师收费界面通知书编码 取出学生信息及物资领取信息 缴费情况信息。 */
    getAdminStudentResource: function(notice_number) {
        var params = {
            notice_number: notice_number
        }
        return Axios.post(apiUrl + 'student/index', params);
    },

    /* 根据学生入学通知书编码 取出学生信息及物资领取信息 缴费情况信息。 */
    /* getAdminStudentPayment: function(pay_type) {
        return Axios.post(apiUrl + 'student/setpaystate', pay_type);
    }, */
    getAdminStudentPayment: function(pay_type) {
        return Axios.put(apiUrl + 'student/setpaystate', pay_type);
    },

    /* 物品发放接口 */
    issueGoods: function(params) {
        return Axios.post(apiUrl + 'student/issuegoods', params)
    },

    /* 根据学生id修改缴费状态为：交费、线下交费 */
    studentPayStatus: function(studentId,moneyList) {
        return Axios.put(apiUrl + 'charge/'+ studentId +'/update', moneyList)
    },

    getTeacherDetail:() => Axios.post(apiUrl + 'charge/getTeacherDetail'),
    exportTeacherExecl:(params) => Axios.get(apiUrl + 'charge/exportTeacherExecl', {params:params}),

    /*一卡通号码输入*/
    setcardNumber:(params) => Axios.post(apiUrl + 'student/setcardnumber', params),

    classDataExportExecl:(params) => Axios.get(apiUrl + 'charge/exportChargeCategories', params),






}
